class Student:
    name = None  # 姓名
    sex = None  # 性别
    country = None  # 国籍
    native_place = None  # 籍贯
    age = None  # 年龄

    def __init__(self):
        super().__init__()

    def __init__(self, name, sex, age):
        self.name = name
        self.sex = sex
        self.age = age

    # 调用say_hi1时正常打印
    def say_hi1(self):
        print(f"大家好，我叫{self.name}")

    # 调用say_hi2时报错，'name' is not defined
    # def say_hi2(self):
    #     print(f"大家好，我叫{name}")


stu_1 = Student()
stu_2 = Student()
stu_3 = Student()

stu_1.name = "李白"
stu_2.name = "观止"
stu_3.name = "罗辑"

print(stu_1.name)

stu_1.say_hi1()

stu_4 = Student("张三","男",18)
print(stu_4.name)
